package com.ebuildy.component
{
	import mx.controls.Tree;
	import mx.controls.listClasses.IListItemRenderer;
	import mx.events.DragEvent;
	
	public class ExtendedTree extends Tree
	{
		public function setHighlightItemRenderer(data:IListItemRenderer):void
		{
			this.highlightItemRenderer = data;
			
			super.selectItem(data,false,false,true);
		}
		
		public function setHighlightItem(data:Object):void
		{
			this.highlightUID = super.itemToUID(data);
			
			super.selectItem(this.itemToItemRenderer(data),false,false,true);
		}
		
		public function getDropItem(e:DragEvent):Object
		{            
			if (this.calculateDropIndex(e) != -1 && this.indexToItemRenderer(this.calculateDropIndex(e)) != null)
			{
	            return this.indexToItemRenderer(this.calculateDropIndex(e)).data;
	  		}
	  		else
	  		{
	  			return null;
	  		}
		}
	}
}